package com.financing.wap.dao.impl;



import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.financing.wap.common.SqlName;
import com.financing.wap.dao.IPublicActivitiesDao;
import com.financing.wap.dto.ProductDTO;
import com.financing.wap.dto.PublicActivitiesDTO;
import com.financing.wap.dto.PublicActivitiesPersonDTO;
import com.financing.wap.vo.PublicActivitiesVo;

@Repository("publicActivitiesDaoImpl")
@SuppressWarnings(value={"unchecked", "deprecation"})
public class PublicActivitiesDaoImpl extends BaseDaoImpl<PublicActivitiesDTO, Integer>  implements IPublicActivitiesDao {

	public int addPublicActivites(PublicActivitiesDTO publicActivitiesDTO)
			throws SQLException {
		return (Integer) this.sqlMapClientTemplate.insert(SqlName.PUBLIC_ACTIVITIES_ADD, publicActivitiesDTO);
	}

	public List<PublicActivitiesDTO> publicActivitiesList() throws SQLException {
		return this.sqlMapClientTemplate.queryForList(SqlName.PUBLIC_ACTIVITIES_LIST);
	}
	@Override
	public PublicActivitiesVo queryPublicActivities(
			PublicActivitiesDTO publicActivitiesDTO) throws SQLException {
		return (PublicActivitiesVo) this.sqlMapClientTemplate.queryForObject(SqlName.PUBLIC_ACTIVITIES_QUERY, publicActivitiesDTO);
	}

	public int updatePublicActivities(PublicActivitiesDTO publicActivitiesDTO)
			throws SQLException {
		return this.sqlMapClientTemplate.update(SqlName.PUBLIC_ACTIVITIES_UPDATE,publicActivitiesDTO);
	}

	@Override
	public Class<PublicActivitiesDTO> getEntityClass() {
		return PublicActivitiesDTO.class;
	}

	@Override
	public List<PublicActivitiesVo> getPublicActivitiesList(
			Map<String, Object> parameter) throws SQLException {
		return this.sqlMapClientTemplate.queryForList(SqlName.PUBLIC_ACTIVITIES_LIST, parameter);
	}

	@Override
	public int getPublicActivitiesCount(Map<String, Object> parameter)  throws SQLException {
		return (Integer) super.sqlMapClientTemplate.queryForObject( SqlName.PUBLIC_ACTIVITIES_LIST_COUNT, parameter);
	}

	@Override
	public int addPublicActivitiesPerson(PublicActivitiesPersonDTO bean)
			throws SQLException {
		return (Integer) this.sqlMapClientTemplate.insert(SqlName.PUBLIC_ACTIVITIES_PERSON_ADD, bean);
	}

}
